﻿#ifndef TARGETCLI_H
#define TARGETCLI_H

#include <QObject>
#include <QNetworkReply>
#include <QTcpSocket>
#include <QTimer>
#include <QJsonArray>
#include <QJsonObject>
#include <QJsonDocument>
#include <QVector>
#include "oeasycommon.h"
#include "ipc.h"



class TargetCli : public QObject
{
    Q_OBJECT
public:
    explicit TargetCli(QString id, STRUCT_TARGET_INFO target_cfg, STRUCT_GENERAL_CONFIG general_cfg, QList<IPC *> ipcList, QObject *parent = 0);
    ~TargetCli();

private:
    QString m_proxyId;
    QTcpSocket *m_pSock;
    STRUCT_TARGET_INFO m_target_cfg;
    STRUCT_GENERAL_CONFIG m_general_cfg;
    QTimer *m_pTimer;
    QList<IPC *> m_ipcList;
    QJsonArray m_ipcArray;
    QByteArray m_msg;
    QVector<QJsonArray> m_snapArray;
    int m_nCountPeople;

signals:
    void textRecv(QString);
    void postPic(QByteArray);
    void postTmpPic(QByteArray);
    void postReport(QByteArray);
    void postBigData(QByteArray);

public slots:
    void onRead();
    void onTimeout();
    void onError(QAbstractSocket::SocketError);
    void OnSendToTargetCli(QByteArray);
};

#endif // TARGETCLI_H
